package com.pulanit.pangu.admin.common;

import com.alibaba.fastjson2.JSON;
import com.pulanit.pangu.admin.common.domain.UserInfo;

/**
 * 应用上下文
 */
public class AppContext {

    /**
     * 获取登录用户信息
     * @return
     */
    public static UserInfo getUserInfo(){
        UserInfo userInfo = null;
        Object obj = LocalCache.getWithUpdateLastAccess(AppConstants.CURRENT_USER_KEY);
        if (obj == null){
            return null;
        }else {
            userInfo = JSON.parseObject(String.valueOf(obj), UserInfo.class);
        }
        return userInfo;
    }
}
